<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org/">
<head>
    <title>主页</title>
    <link rel="stylesheet" type="text/css" th:href="@{/static/layui/css/layui.css}"/>
    <script th:src="@{/static/layui/layui.js}" type="text/javascript" charset="utf-8"></script>
</head>
<body class="layui-layout-body">
<div class="layui-layout layui-layout-admin">
    <div class="layui-header">
        <div class="layui-logo">天天鲜商店官网</div>
        <ul class="layui-nav layui-layout-left"> </ul>
        <ul class="layui-nav layui-layout-right">
            <li class="layui-nav-item">
                <a href="javascript:;">
                    <img width="40px" height="30px" th:src="'/pic/'+${session.admin.image}"/> <!--${user.name}-->
                    <span th:text="${session.admin.name}"></span>
                </a>
                <dl class="layui-nav-child">
                    <dd>
                        <a href="javascript:openUser()">基本资料</a>
                    </dd>
                    <dd>
                        <a href="javascript:openPass()">修改密码</a>
                    </dd>
                    <dd>
                        <a href="javascript:openPic()">修改头像</a>
                    </dd>
                </dl>
            </li>
            <li class="layui-nav-item">
                <a href="javascript:logout()">注销</a>
            </li>
        </ul>
    </div>
    <div class="layui-side layui-bg-black">
        <div class="layui-side-scroll">
            <!-- 左侧导航区域（可配合layui已有的垂直导航） -->
            <ul class="layui-nav layui-nav-tree" >
                <li class="layui-nav-item layui-nav-itemed">
                    <a href="javascript:;">Mall</a>
                    <dl class="layui-nav-child">
                        <dd>
                            <a href="javascript:;"
                               data-url="/page/admin/list"
                               class="site-demo-active">后端管理员管理</a>
                        </dd>
                        <dd>
                            <a href="javascript:;"
                               data-url="/page/user/list"
                               class="site-demo-active">用户管理</a>
                        </dd>
                        <dd>
                            <a href="javascript:;"
                               data-url="/page/product/list"
                               class="site-demo-active">商品管理</a>
                        </dd>
                        <dd>
                            <a href="javascript:;"
                               data-url="/page/category/list"
                               class="site-demo-active">分类管理</a>
                        </dd>
                        <dd>
                            <a href="javascript:;"
                               data-url="/page/cart/list"
                               class="site-demo-active">购物车管理</a>
                        </dd>
                        <dd>
                            <a href="javascript:;"
                               data-url="/page/payInfo/list"
                               class="site-demo-active">支付信息管理</a>
                        </dd>
                        <dd>
                            <a href="javascript:;"
                               data-url="/page/order/list"
                               class="site-demo-active">订单管理</a>
                        </dd>
                        <!--<dd>
                            <a href="javascript:;"
                               data-url="/page/orderItem/list"
                               class="site-demo-active">orderItem管理</a>
                        </dd>-->
                        <dd>
                            <a href="javascript:;"
                               data-url="/page/shipping/list"
                               class="site-demo-active">收货地址管理</a>
                        </dd>
                        <dd>
                            <a href="javascript:;"
                               data-url="/page/operlog"
                               class="site-demo-active">操作日志</a>
                        </dd>
                        <dd>
                            <a href="javascript:;"
                               data-url="/page/echarts"
                               class="site-demo-active">ECharts</a>
                        </dd>

                    </dl>
                </li>
                <li class="layui-nav-item">
                    <a href="javascript:;">基础配置</a>
                    <dl class="layui-nav-child">
                        <dd>
                            <a href="javascript:;"
                               class="site-demo-active"
                               data-url="/com.situ.web/page/dict/dictlist.jsp">
                                基础数据维护</a>
                        </dd>
                        <dd>
                            <a href="javascript:;" class="site-demo-active"
                               data-url="/com.situ.web/404.jsp">404-1</a>
                        </dd>
                    </dl>
                </li>
            </ul>
        </div>
    </div>
    <div class="layui-body"><!-- 内容主体区域 -->
        <iframe name="rightframe" width="99%" height="97%" src="/page/echarts"></iframe>
    </div>
    <div class="layui-footer">© JAVA - 底部固定区域</div>
</div>
<script type="text/javascript" th:inline="javascript">
    var $ = layui.jquery;
    var layer = layui.layer;
    var element = layui.element;
    $('.site-demo-active').click(function() {
        window.open($(this).data('url'), "rightframe");
    });
    element.render();// element.init();
    function openURL(url){
        window.open(url, "rightframe");
    }

    function openUser() {
        layer.open({
            type:2,
            title:'管理员基本信息',
            area:['50%','50%'],// 宽高
            content:'/page/openAdmin?id=' + '[[${session.admin.id}]]',
        });
    }


    function openPass() {
        //console.log('修改密码获取当前user的id: ' + userId);
        var index = layer.open({
            type:2,
            title:'修改密码',
            area:['40%','60%'],// 宽高
            content: '/page/openPass?id=' + '[[${session.admin.id}]]',
        });
    }

    function openPic() {
        layer.open({
            type:2,
            title:'上传图片',
            area:['50%','50%'],// 宽高
            content:'/page/openPic?id=' + '[[${session.admin.id}]]',
        });
    }


    function logout() {
        layer.confirm('您确认要删除么?', {icon:3}, function() {
            $.post(
                '/admin/logout',
                function (result) {
                    if (result.code == 0) {
                        location.href = '/page/login';
                    }
                },
                'json'
            );
        });
        /*layer.confirm(
                '您确认要退出么',
                {icon:3},
                function() {
                    location.href = '/user?method=logout'
                }
        );*/
    }

</script>
</body>
</html>